package org.liveboardgames.agricola.business;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.liveboardgames.agricola.access.ICardDao;
import org.liveboardgames.agricola.domain.card.ActionCard;

public class WaitingActionCardsServiceImpl implements IWaitingActionCardsService {

  private ICardDao cardDao;

  public void setCardDao(ICardDao cardDao) {
    this.cardDao = cardDao;
  }

  public List<ActionCard> createWaitingActionCards() {
    List<ActionCard> actionCards = new ArrayList<ActionCard>();
    for (int i = 1; i < 7; i++) {
      List<ActionCard> periodCards = cardDao.getActionCardsForPeriod(i);
      Collections.shuffle(periodCards);
      actionCards.addAll(periodCards);
    }
    return actionCards;
  }

}
